var express = require('express')
var router = express.Router()
//引入自定义的控制器
const IndexController = require('../controllers/index.js')

/* GET home page. */
router.get('/', function (req, res, next) {
  res.render('index', { title: 'Express' })
})

//1、定义活动列表路由，GET请求
router.get('/event', IndexController.eventList1)

//2、定义分类列表路由，GET请求
router.get('/cate', IndexController.getCatelist)

//3、定义文章列表路由，GET请求
router.get('/article', IndexController.getArticleList)

//4、定义文章详情路由，GET请求
router.get('/article/:articleId', IndexController.getArticleDetailById)

//5、定义案例列表路由，GET请求
router.get('/case', IndexController.getCaseList)

//6、定义案例详情路由，GET请求
//router.get('/case/:caseId', IndexController.caseCompany)

//7、定义企业信息路由，GET请求
router.get('/company', IndexController.getCompanyInfo)

//8、定义预约路由，POST请求
router.post('/order', IndexController.createOrder)

//9、分页请求案例数据
router.get('/caselist', IndexController.getCases)

//10、案例的添加操作
router.post('/caselist', IndexController.addCase)

//11、文件上传操作
router.post('/upload', IndexController.upload)

//12、根据id(pk主键)获得当前的案例对象
router.get('/caselist/:id', IndexController.getCaseByPk)

//13、根据id修改case
router.put('/caselist', IndexController.updateCase)

//14、根据id(pk主键)删除当前的案例对象
router.delete('/caselist/:id', IndexController.deleteCaseById)
module.exports = router
